/*
 * @Author: 噜噜雯雯 2199987619@qq.com
 * @Date: 2025-09-04 16:43:34
 * @LastEditors: 噜噜雯雯 2199987619@qq.com
 * @LastEditTime: 2025-09-11 15:22:29
 * @FilePath: \linePatrol\vue-element-plus-admin\src\api\securcheck\CompanyLedger.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/axios/http'
import { TableIResponse } from '@/utils/Api'
import { ref } from 'vue'
import { FloorChart, FloorLedger } from './type'
export class SecurCheckFloorApi {
  //查询楼宇台账信息
  async GetFloorLedger(params: any): Promise<TableIResponse<FloorLedger[]>> {
    const result = (await service.get('/api/securcheck/tbFloorLedger/list', {
      params
    })) as unknown as any
    return result
  }
  //删除楼宇台账信息
  async DeletFloorLedger(uuids: string | undefined): Promise<boolean> {
    const result = (await service.delete(
      `/api/securcheck/tbFloorLedger/${uuids}`
    )) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }

  // 修改楼宇台账信息
  async EditFloorLedger(data: FloorChart): Promise<boolean> {
    const result = (await service.put('/api/securcheck/tbFloorLedger', data)) as unknown as any
    const { code } = result as any
    if (code == 200) {
      return true
    } else {
      return false
    }
  }
  //查询楼宇图信息列表
  async GetfloorChart(params: any): Promise<FloorChart[]> {
    const result = (await service.get(`/api/securcheck/tbFloorLedger/floorChart`, {
      params
    })) as unknown as any
    const { code, data } = result as any
    const res = ref<FloorChart[]>([])
    if (code == 200) {
      return data
    } else {
      return res.value
    }
  }
  //更新楼宇台账数据
  async UpdateFloorChart(params: any): Promise<FloorChart[]> {
    const result = (await service.get(`/api/securcheck/tbFloorLedger/upData`, {
      params
    })) as unknown as any
    return result
  }
}
export default new SecurCheckFloorApi()
